import React from 'react';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';
import InboxIcon from '@material-ui/icons/MoveToInbox';
import { createHashHistory } from 'history'; // 如果是hash路由

const history = createHashHistory();

export default function DefaultMenuList() {
    function changeRoute(path){
        history.push(path);
    }

    return (
        <React.Fragment>
            <List>
                <ListItem button key={'a'}>
                    <ListItemIcon><InboxIcon/></ListItemIcon>
                    <ListItemText onClick={() => changeRoute('/a')} primary="a"/>
                </ListItem>
                <ListItem button key={'b'}>
                    <ListItemIcon><InboxIcon/></ListItemIcon>
                    <ListItemText onClick={() => changeRoute('/b')} primary="b"/>
                </ListItem>
            </List> 
        </React.Fragment>
    )
}